﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Validation="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient.Validation;assembly=Sinacor.Infra.UI.Controls"
    xmlns:Controls="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient;assembly=Sinacor.Infra.UI.Controls"
    xmlns:XceedControls="http://schemas.xceed.com/wpf/xaml/datagrid"
    xmlns:XceedViews="clr-namespace:Xceed.Wpf.DataGrid.Views;assembly=Xceed.Wpf.DataGrid"
    xmlns:XceedMarkup="clr-namespace:Xceed.Wpf.DataGrid.Markup;assembly=Xceed.Wpf.DataGrid"
    xmlns:ControlsInternal="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient.Internal;assembly=Sinacor.Infra.UI.Controls"
    xmlns:Edit="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient.Edit;assembly=Sinacor.Infra.UI.Controls"
    xmlns:conv="clr-namespace:Xceed.Wpf.DataGrid.Converters;assembly=Xceed.Wpf.DataGrid"
    xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase">

    <Style x:Key="cellErrorStyle" TargetType="XceedControls:Cell">
        <Setter Property="Background" Value="{DynamicResource errorBackgroundBrush}"/>
        <Setter Property="Foreground" Value="{DynamicResource errorForegroundBrush}"/>
        <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self},Path=ValidationError.ErrorContent}"/>
    </Style>

    <!--BEGIN TEXTBLOCK-->
    <Style TargetType="{x:Type Controls:SinacorTextBlock}">
        <Setter Property="TextElement.Foreground" Value="{DynamicResource BrushTextBlockForeground}"/>
        <Setter Property="TextElement.Background" Value="{DynamicResource BrushTextBlockBackground}"/>
        <Setter Property="TextElement.FontFamily" Value="Tahoma"/>
        <Setter Property="TextElement.FontSize" Value="11"/>
        <Setter Property="TextElement.FontWeight" Value="Normal" />
        <Setter Property="TextElement.FontStyle" Value="Normal" />
        <Setter Property="Width" Value="100"/>
        <Setter Property="Height" Value="21"/>
    </Style>

    <Style x:Key="ControlDataGridTextBlock" TargetType="{x:Type Controls:SinacorTextBlock}" BasedOn="{StaticResource {x:Type Controls:SinacorTextBlock}}">
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="Height" Value="Auto"/>
    </Style>

    <Style x:Key="ControlDataGridTitleTextBlock" TargetType="{x:Type Controls:SinacorTextBlock}" BasedOn="{StaticResource ControlDataGridTextBlock}">
        <Setter Property="TextElement.Foreground" Value="{DynamicResource BrushControlDataGridTitleTextBlock}"/>
    </Style>
    <!--END TEXTBLOCK-->

    <!--BEGIN LABEL-->
    <ControlTemplate x:Key="ControlLabel" TargetType="{x:Type Controls:SinacorLabel}">
        <Border SnapsToDevicePixels="true" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" Width="{TemplateBinding Width}">
            <StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                <Label x:Name="PART_RequiredSymbol" Content="*" Foreground="{DynamicResource BrushLabelRequiredFieldForeground}" Style="{DynamicResource ControlFont}" Padding="0" Visibility="Collapsed" Margin="0,0,3,0"/>
                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="{TemplateBinding RecognizesAccessKey}" Style="{DynamicResource ControlFont}"/>
            </StackPanel>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{DynamicResource BrushLabelForegroundDisabled}"/>
                <Setter Property="Foreground" Value="{DynamicResource BrushLabelRequiredFieldForegroundDisabled}" TargetName="PART_RequiredSymbol"/>
            </Trigger>
            <Trigger Property="IsTargetFieldRequired" Value="True">
                <Setter Property="Visibility" Value="Visible" TargetName="PART_RequiredSymbol"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="{x:Type Controls:SinacorLabel}">
        <Setter Property="Foreground" Value="{DynamicResource BrushLabelForeground}"/>
        <Setter Property="Background" Value="{DynamicResource BrushLabelBackground}"/>
        <Setter Property="Padding" Value="3,3,3,3"/>
        <Setter Property="HorizontalContentAlignment" Value="Right"/>
        <Setter Property="VerticalContentAlignment" Value="Bottom"/>
        <Setter Property="VerticalAlignment" Value="Top"/>
        <Setter Property="Height" Value="21"/>
        <Setter Property="Width" Value="100"/>
        <Setter Property="Template" Value="{StaticResource ControlLabel}"/>
    </Style>

    <Style x:Key="ControlDataGridLabel" TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="Height" Value="Auto"/>
        <Setter Property="MinHeight" Value="21"/>
    </Style>
    <!--END LABEL-->


    <!-- SinacorDataGrid -->
    <Style TargetType="{x:Type Controls:SinacorDataGrid}">
        <Style.Resources>
            <BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" />
        </Style.Resources>
        <Setter Property="RowHeight" Value="22" />
        <Setter Property="MinRowHeight" Value="22" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:SinacorDataGrid}">
                    <Grid DataContext="{x:Null}">
                        <Grid.ContextMenu>

                            <!-- DataGridContextMenu -->
                            <Controls:SinacorContextMenu x:Name="DataGridContextMenu">
                                <!--<Controls:SinacorContextMenu.Resources>
                                    <BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" />
                                </Controls:SinacorContextMenu.Resources>-->

                                <!-- ContextMenuTemplate -->
                                <StackPanel>
                                    <StackPanel.Style>
                                        <Style>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding ContextMenuTemplate, RelativeSource={RelativeSource TemplatedParent}}" Value="{x:Null}">
                                                    <Setter Property="UIElement.Visibility" Value="Collapsed" />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </StackPanel.Style>
                                    <ContentPresenter ContentTemplate="{Binding ContextMenuTemplate, RelativeSource={RelativeSource TemplatedParent}}"
                                    ContentTemplateSelector="{Binding ContextMenuTemplateSelector, RelativeSource={RelativeSource TemplatedParent}}" />
                                    <Controls:SinacorContextMenuItemSeparator />
                                </StackPanel>

                                <!-- Navegação -->

                                <!-- SelectFirstItem -->
                                <Controls:SinacorContextMenuItem Header="{DynamicResource Infra.Controls.Label.IrParaPrimeiro}" Command="Controls:SelectionCommands.SelectFirstItem" CommandTarget="{Binding Path=., RelativeSource={RelativeSource TemplatedParent}}" />
                                <!-- SelectLastItem -->
                                <Controls:SinacorContextMenuItem Header="{DynamicResource Infra.Controls.Label.IrParaUltimo}" Command="Controls:SelectionCommands.SelectLastItem" CommandTarget="{Binding Path=., RelativeSource={RelativeSource TemplatedParent}}" />

                                <!-- Cópia para área de transferência -->
                                <StackPanel>
                                    <StackPanel.Style>
                                        <Style>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding IsCopyableClipboard, RelativeSource={RelativeSource TemplatedParent}}" Value="False">
                                                    <Setter Property="UIElement.Visibility" Value="Collapsed" />
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding IsEditing, RelativeSource={RelativeSource TemplatedParent}}" Value="True">
                                                    <Setter Property="UIElement.Visibility" Value="Collapsed" />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </StackPanel.Style>

                                    <Controls:SinacorContextMenuItemSeparator />
                                    <!-- Copy -->
                                    <Controls:SinacorContextMenuItem ContextMenuItemIcon="IconContextMenuCopy" Header="{DynamicResource Infra.Controls.Label.Copiar}" Command="ApplicationCommands.Copy" CommandTarget="{Binding Path=., RelativeSource={RelativeSource TemplatedParent}}" />
                                    <!-- CopyAllClipboard -->
                                    <Controls:SinacorContextMenuItem ContextMenuItemIcon="IconContextMenuCopy" Header="{DynamicResource Infra.Controls.Label.CopiarTodos}" Command="Controls:ExportCommands.CopyAllClipboard" CommandTarget="{Binding Path=., RelativeSource={RelativeSource TemplatedParent}}" />
                                </StackPanel>

                                <!-- Edição -->
                                <StackPanel>
                                    <ContentControl>
                                        <ContentControl.Template>
                                            <ControlTemplate>

                                                <StackPanel Name="EditPanel" Visibility="Visible">
                                                    <Controls:SinacorContextMenuItemSeparator />

                                                    <!-- Inserção -->

                                                    <!-- BeginInsert -->
                                                    <Controls:SinacorContextMenuItem ContextMenuItemIcon="IconContextMenuNew" Name="BeginInsert" Header="{DynamicResource Infra.Controls.Label.Novo}" Command="Edit:EditCommands.BeginInsert" CommandTarget="{Binding Path=., RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" />

                                                    <!-- Alteração -->

                                                    <!-- BeginUpdate -->
                                                    <Controls:SinacorContextMenuItem ContextMenuItemIcon="IconContextMenuEdit" Name="BeginUpdate" Header="{DynamicResource Infra.Controls.Label.Alterar}" Command="Edit:EditCommands.BeginUpdate" CommandTarget="{Binding Path=., RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" />

                                                    <!-- Exclusão -->

                                                    <!-- Delete -->
                                                    <Controls:SinacorContextMenuItem ContextMenuItemIcon="IconContextMenuDelete" Name="Delete" Header="{DynamicResource Infra.Controls.Label.Excluir}" Command="Edit:EditCommands.Delete" CommandTarget="{Binding Path=., RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" />

                                                </StackPanel>

                                                <ControlTemplate.Triggers>
                                                    <DataTrigger Binding="{Binding IsInsertable, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" Value="False">
                                                        <Setter Property="UIElement.Visibility" Value="Collapsed" TargetName="BeginInsert" />
                                                    </DataTrigger>
                                                    <DataTrigger Binding="{Binding AllowBeginInsert, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" Value="False">
                                                        <Setter Property="UIElement.Visibility" Value="Collapsed" TargetName="BeginInsert" />
                                                    </DataTrigger>

                                                    <DataTrigger Binding="{Binding IsUpdatable, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" Value="False">
                                                        <Setter Property="UIElement.Visibility" Value="Collapsed" TargetName="BeginUpdate" />
                                                    </DataTrigger>
                                                    <DataTrigger Binding="{Binding AllowBeginUpdate, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" Value="False">
                                                        <Setter Property="UIElement.Visibility" Value="Collapsed" TargetName="BeginUpdate" />
                                                    </DataTrigger>

                                                    <DataTrigger Binding="{Binding AllowDelete, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" Value="False">
                                                        <Setter Property="UIElement.Visibility" Value="Collapsed" TargetName="Delete" />
                                                    </DataTrigger>

                                                    <MultiTrigger>
                                                        <MultiTrigger.Conditions>
                                                            <Condition Property="UIElement.Visibility" Value="Collapsed" SourceName="BeginInsert" />
                                                            <Condition Property="UIElement.Visibility" Value="Collapsed" SourceName="BeginUpdate" />
                                                            <Condition Property="UIElement.Visibility" Value="Collapsed" SourceName="Delete" />
                                                        </MultiTrigger.Conditions>
                                                        <Setter Property="UIElement.Visibility" Value="Collapsed" TargetName="EditPanel" />
                                                    </MultiTrigger>

                                                    <DataTrigger Binding="{Binding IsEditing, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" Value="True">
                                                        <Setter Property="UIElement.Visibility" Value="Collapsed" TargetName="EditPanel" />
                                                    </DataTrigger>
                                                </ControlTemplate.Triggers>
                                            </ControlTemplate>
                                        </ContentControl.Template>
                                    </ContentControl>

                                    <ContentControl>
                                        <ContentControl.Template>
                                            <ControlTemplate>

                                                <StackPanel Name="EditPanel" Visibility="Visible">
                                                    <Controls:SinacorContextMenuItemSeparator />

                                                    <!-- Inserção -->

                                                    <!-- EndInsert -->
                                                    <Controls:SinacorContextMenuItem ContextMenuItemIcon="IconContextMenuOK" Name="EndInsert" Header="{DynamicResource Infra.Controls.Tooltip.Salvar}" Command="Edit:EditCommands.EndInsert" CommandTarget="{Binding Path=., RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" Visibility="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource booleanToVisibilityConverter}}" />
                                                    <!-- CancelInsert -->
                                                    <Controls:SinacorContextMenuItem ContextMenuItemIcon="IconContextMenuCancel" Name="CancelInsert" Header="{DynamicResource Infra.Controls.Label.Cancelar}" Command="Edit:EditCommands.CancelInsert" CommandTarget="{Binding Path=., RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" Visibility="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource booleanToVisibilityConverter}}" />

                                                    <!-- Alteração -->

                                                    <!-- EndUpdate -->
                                                    <Controls:SinacorContextMenuItem ContextMenuItemIcon="IconContextMenuOK" Name="EndUpdate" Header="{DynamicResource Infra.Controls.Tooltip.Salvar}" Command="Edit:EditCommands.EndUpdate" CommandTarget="{Binding Path=., RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" Visibility="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource booleanToVisibilityConverter}}" />
                                                    <!-- CancelUpdate -->
                                                    <Controls:SinacorContextMenuItem ContextMenuItemIcon="IconContextMenuCancel" Name="CancelUpdate" Header="{DynamicResource Infra.Controls.Label.Cancelar}" Command="Edit:EditCommands.CancelUpdate" CommandTarget="{Binding Path=., RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" Visibility="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource booleanToVisibilityConverter}}" />

                                                </StackPanel>
                                                <ControlTemplate.Triggers>
                                                    <MultiTrigger>
                                                        <MultiTrigger.Conditions>
                                                            <Condition Property="UIElement.Visibility" Value="Collapsed" SourceName="EndInsert" />
                                                            <Condition Property="UIElement.Visibility" Value="Collapsed" SourceName="CancelInsert" />
                                                            <Condition Property="UIElement.Visibility" Value="Collapsed" SourceName="EndUpdate" />
                                                            <Condition Property="UIElement.Visibility" Value="Collapsed" SourceName="CancelUpdate" />
                                                        </MultiTrigger.Conditions>
                                                        <Setter Property="UIElement.Visibility" Value="Collapsed" TargetName="EditPanel" />
                                                    </MultiTrigger>
                                                </ControlTemplate.Triggers>
                                            </ControlTemplate>
                                        </ContentControl.Template>
                                    </ContentControl>
                                </StackPanel>

                                <!-- Controle de Estado -->
                                <StackPanel>
                                    <StackPanel.Style>
                                        <Style>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding IsStateControlEnabled, RelativeSource={RelativeSource TemplatedParent}}" Value="False">
                                                    <Setter Property="UIElement.Visibility" Value="Collapsed" />
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding IsStateControlAllowed, RelativeSource={RelativeSource TemplatedParent}}" Value="False">
                                                    <Setter Property="UIElement.Visibility" Value="Collapsed" />
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding IsEditing, RelativeSource={RelativeSource TemplatedParent}}" Value="True">
                                                    <Setter Property="UIElement.Visibility" Value="Collapsed" />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </StackPanel.Style>
                                    <Controls:SinacorContextMenuItemSeparator />
                                    <!-- Save -->
                                    <Controls:SinacorContextMenuItem ContextMenuItemIcon="IconContextMenuSave"
                                                   Header="{DynamicResource Infra.Controls.Label.SalvarSelecionados}"
                                                   Command="Controls:StateControlCommands.Save"
                                                   CommandTarget="{Binding Path=., RelativeSource={RelativeSource TemplatedParent}}"
                                                   Visibility="{Binding AllowSave, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource booleanToVisibilityConverter}}" />
                                    <!-- SaveAll -->
                                    <Controls:SinacorContextMenuItem ContextMenuItemIcon="IconContextMenuSave"
                                                   Header="{DynamicResource Infra.Controls.Label.SalvarTudo}"
                                                   Command="Controls:StateControlCommands.SaveAll"
                                                   CommandTarget="{Binding Path=., RelativeSource={RelativeSource TemplatedParent}}"
                                                   Visibility="{Binding AllowSaveAll, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource booleanToVisibilityConverter}}" />
                                    <!-- Undo -->
                                    <Controls:SinacorContextMenuItem ContextMenuItemIcon="IconContextMenuUndoLast"
                                                   Header="{DynamicResource Infra.Controls.Label.DesfazerSelecionados}"
                                                   Command="Controls:StateControlCommands.Undo"
                                                   CommandTarget="{Binding Path=., RelativeSource={RelativeSource TemplatedParent}}"
                                                   Visibility="{Binding AllowUndo, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource booleanToVisibilityConverter}}" />
                                    <!-- UndoLast -->
                                    <Controls:SinacorContextMenuItem ContextMenuItemIcon="IconContextMenuUndoLast"
                                                   Header="{DynamicResource Infra.Controls.Label.DesfazerUltimaAlteracao}"
                                                   Command="Controls:StateControlCommands.UndoLast"
                                                   CommandTarget="{Binding Path=., RelativeSource={RelativeSource TemplatedParent}}"
                                                   Visibility="{Binding AllowUndoLast, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource booleanToVisibilityConverter}}" />
                                    <!-- UndoAll -->
                                    <Controls:SinacorContextMenuItem ContextMenuItemIcon="IconContextMenuUndoAll"
                                                   Header="{DynamicResource Infra.Controls.Label.DesfazerTudo}"
                                                   Command="Controls:StateControlCommands.UndoAll"
                                                   CommandTarget="{Binding Path=., RelativeSource={RelativeSource TemplatedParent}}"
                                                   Visibility="{Binding AllowUndoAll, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource booleanToVisibilityConverter}}" />
                                </StackPanel>

                                <!-- Expotação para Excel -->
                                <StackPanel>
                                    <StackPanel.Style>
                                        <Style>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding IsExportableExcel, RelativeSource={RelativeSource TemplatedParent}}" Value="False">
                                                    <Setter Property="UIElement.Visibility" Value="Collapsed" />
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding IsEditing, RelativeSource={RelativeSource TemplatedParent}}" Value="True">
                                                    <Setter Property="UIElement.Visibility" Value="Collapsed" />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </StackPanel.Style>

                                    <Controls:SinacorContextMenuItemSeparator />
                                    <!-- ExportAllExcel -->
                                    <Controls:SinacorContextMenuItem ContextMenuItemIcon="IconContextMenuExcel" Header="{DynamicResource Infra.Controls.Label.ExportarExcel}" Command="Controls:ExportCommands.ExportAllExcel" CommandTarget="{Binding Path=., RelativeSource={RelativeSource TemplatedParent}}" />
                                </StackPanel>

                                <!-- Gerar Relatório -->
                                <StackPanel>
                                    <!--<StackPanel.Style>
                                        <Style>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding IsExportableExcel, RelativeSource={RelativeSource TemplatedParent}}" Value="False">
                                                    <Setter Property="UIElement.Visibility" Value="Collapsed" />
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding IsEditing, RelativeSource={RelativeSource TemplatedParent}}" Value="True">
                                                    <Setter Property="UIElement.Visibility" Value="Collapsed" />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </StackPanel.Style>-->

                                    <!--<Controls:SinacorContextMenuItemSeparator />-->
                                    <!-- ExportReport -->
                                    <!--<Controls:SinacorContextMenuItem Header="{DynamicResource Infra.Controls.Label.ExportarRelatorio}" Command="Controls:ExportCommands.ExportReport" CommandTarget="{Binding Path=., RelativeSource={RelativeSource TemplatedParent}}" />-->
                                </StackPanel>

                            </Controls:SinacorContextMenu>

                        </Grid.ContextMenu>
                        <!-- The PART_CellsHost part designates the Panel to which this Row's Cells should be added.-->
                        <Border Grid.Row="0" Grid.Column="0" x:Name="PART_Border" Validation:ValidationManager.ValidationGroup="{x:Null}">
                            <ContentPresenter x:Name="PART_DataGrid" />
                        </Border>
                        <Controls:SinacorChangesMonitorContainer Grid.Row="1" Grid.Column="0" Name="PART_ChangesMonitor" Focusable="False" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- TableViewScrollViewer -->
    <Style TargetType="{x:Type XceedControls:TableViewScrollViewer}">
        <Setter Property="TextElement.FontFamily" Value="Tahoma"/>
        <Setter Property="TextElement.FontSize" Value="12"/>
        <Setter Property="VerticalScrollBarVisibility" Value="Visible" />
        <Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="CanContentScroll" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type XceedControls:TableViewScrollViewer}">
                    <!-- Root Grid that layout the "content" and the Scrollbars -->
                    <Grid SnapsToDevicePixels="True">
                        <Grid.ColumnDefinitions>
                            <!-- Content -->
                            <ColumnDefinition />

                            <!-- Vertical ScrollBar -->
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                            <!-- Content -->
                            <RowDefinition />

                            <!-- Horizontal ScrollBar -->
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <!-- Content -->

                        <Grid Margin="{TemplateBinding Padding}">
                            <Grid.ColumnDefinitions>
                                <!-- RowSelectorPane-->
                                <ColumnDefinition Width="Auto"/>

                                <!-- ScrollContentPresenter -->
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>

                            <Grid.RowDefinitions>
                                <!-- Fixed Headers -->
                                <RowDefinition Height="Auto"/>

                                <!-- ScrollContentPresenter -->
                                <RowDefinition/>

                                <!-- Fixed Footers -->
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <!-- This Border is used to display a black border around the RowSelectorPane-->
                            <Border BorderBrush="{DynamicResource BrushRowSelectorPane}" BorderThickness="0" Margin="0" Grid.Column="0" Grid.Row="0" Grid.RowSpan="3">
                                <Grid>
                                    <!-- RowSelectorPane -->
                                    <XceedControls:RowSelectorPane ItemsPlacementReference="{x:Null}"
                                                 ScrollViewer="{x:Null}"
                                                 x:Name="PART_RowSelectorPane"
                                                 Width="{TemplateBinding XceedControls:TableViewScrollViewer.RowSelectorPaneWidth}"
                                                 Grid.Column="0"
                                                 Grid.Row="0"
                                                 Grid.RowSpan="3" />

                                    <!--<XceedControls:RowSelectorPane x:Name="rowSelectorPane"
                                                          MinWidth="20"
                                                          Grid.Row="1"
                                                          Grid.RowSpan="2"
                                                          ScrollViewer="{Binding RelativeSource={RelativeSource TemplatedParent},Path=.}" />-->

                                    <!--<Border BorderThickness="1,0,1,0"
                                            BorderBrush="#7FFFFFFF"
                                            Grid.Row="1"
                                            Grid.RowSpan="2"/>-->
                                </Grid>
                            </Border>

                            <!--This border will be used to layout the background image properly-->
                            <Border Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" Background="{DynamicResource BrushImageground}"/>
                            <Grid Grid.Column="1" Grid.Row="0">
                                <!-- Fixed Headers -->
                                <XceedControls:SynchronizedScrollViewer XceedControls:TableViewScrollViewer.SynchronizedScrollViewerPosition="Top" Focusable="False">
                                    <StackPanel x:Name="stkHeader"  XceedControls:DataGridControl.IsFixedHeadersHost="True" Orientation="Vertical" HorizontalAlignment="Left"/>
                                </XceedControls:SynchronizedScrollViewer>
                            </Grid>

                            <Border Grid.Column="0" BorderThickness="0" Grid.ColumnSpan="2" Grid.Row="0">
                                <!--<Border BorderThickness="1"
                                         BorderBrush="#6FFFFFFF"/>-->
                            </Border>

                            <!--<Border Grid.Row="1"
                                      Grid.Column="0"
                                      Margin="2,0,2,0"
                                      BorderBrush="#6FFFFFFF"
                                      BorderThickness="0,1,0,1"/>-->

                            <!-- Fixed Footers -->
                            <XceedControls:SynchronizedScrollViewer Grid.Column="1" Grid.Row="2" XceedControls:TableViewScrollViewer.SynchronizedScrollViewerPosition="Bottom" Focusable="False">
                                <StackPanel XceedControls:DataGridControl.IsFixedFootersHost="True" Orientation="Vertical" HorizontalAlignment="Left"/>
                            </XceedControls:SynchronizedScrollViewer>

                            <!-- ScrollContentPresenter (data rows) -->
                            <ScrollContentPresenter Grid.Column="1" Grid.Row="1" CanContentScroll="{TemplateBinding CanContentScroll}" />
                        </Grid>

                        <!-- ScrollBars -->
                        <Controls:SinacorHorizontalScrollBar x:Name="PART_HorizontalScrollBar" Grid.Column="0" Grid.Row="1" Orientation="Horizontal" Maximum="{TemplateBinding ScrollViewer.ScrollableWidth}" Value="{TemplateBinding ScrollViewer.HorizontalOffset}" ViewportSize="{TemplateBinding ScrollViewer.ViewportWidth}" Visibility="{TemplateBinding ScrollViewer.ComputedHorizontalScrollBarVisibility}" />
                        <Controls:SinacorVerticalScrollBar x:Name="PART_VerticalScrollBar" Grid.Column="1" Grid.Row="0" Orientation="Vertical" Maximum="{TemplateBinding ScrollViewer.ScrollableHeight}" Value="{TemplateBinding ScrollViewer.VerticalOffset}" ViewportSize="{TemplateBinding ScrollViewer.ViewportHeight}" Visibility="{TemplateBinding ScrollViewer.ComputedVerticalScrollBarVisibility}" />

                        <!-- ScrollTip only displayed when scrolling -->
                        <!--Since the ViewBinding markup extension is compiled in the same assembly as the XAML, we cannot use its properties and must explode the ViewBinding manually. External users are not affected by this and can replace the following Binding by a much more simple ViewBinding statement.-->
                        <!--<XceedControls:ScrollTip Visibility="Hidden" Content="{x:Null}" ContentTemplate="{Binding RelativeSource={RelativeSource Self}, Path=(XceedControls:DataGridControl.DataGridContext).ScrollTipContentTemplate}" ContentTemplateSelector="{Binding RelativeSource={RelativeSource Self}, Path=(XceedControls:DataGridControl.DataGridContext).ScrollTipContentTemplateSelector}"/>-->
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="XceedControls:TableViewScrollViewer.ShowRowSelectorPane" Value="False">
                            <Setter Property="UIElement.Visibility" TargetName="PART_RowSelectorPane" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <!-- DataRow -->
    <Style TargetType="{x:Type ControlsInternal:DataRow}">
        <Setter Property="Height" Value="{Binding RowHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" />
        <Setter Property="MinHeight" Value="{Binding MinRowHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" />
    </Style>

    <!-- BaseRow -->
    <Style TargetType="{x:Type Controls:BaseRow}">
        <Setter Property="Focusable" Value="False" />
    </Style>

    <!-- Row -->
    <Style TargetType="{x:Type Controls:Row}" BasedOn="{StaticResource {x:Type Controls:BaseRow}}">
        <Style.Resources>
            <XceedControls:IndexToOddConverter x:Key="rowIndexConverter" />
            <Controls:LastRowHeightConverter x:Key="lastRowHeightConverter" />
        </Style.Resources>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:Row}">
                    <Border x:Name="PART_Border"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        Background="{TemplateBinding Background}"
                        Validation:ValidationManager.ValidationGroup="{x:Null}">
                        <Border.ToolTip>
                            <ItemsControl ItemsSource="{Binding Errors}" DisplayMemberPath="Message">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Orientation="Vertical" />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                            </ItemsControl>
                        </Border.ToolTip>
                        <Controls:SinacorGridChangesMonitorContainer Name="PART_RowChangesMonitor" IsMonitoringChanges="False" Focusable="False">
                            <StackPanel x:Name="PART_Panel">
                                <StackPanel x:Name="PART_StackRow" 
                                            Height="{Binding RowHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}"
                                            MinHeight="{Binding MinRowHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}">
                                    <ContentPresenter x:Name="PART_Row" />
                                </StackPanel>
                                <StackPanel Background="{DynamicResource BrushEditPanelBackground}">
                                    <Border x:Name="PART_EditBorder" Visibility="Collapsed" BorderThickness="1,1,1,0" BorderBrush="{DynamicResource BrushEditPanelBorder}">
                                        <Controls:RowEditPanel Margin="7" x:Name="PART_EditPanel"
                                            Content="{TemplateBinding DataContext}"
                                            ContentTemplate="{TemplateBinding PanelUpdateTemplate}"
                                            ContentTemplateSelector="{TemplateBinding PanelUpdateTemplateSelector}"
                                            Visibility="Collapsed"
                                            FocusManager.IsFocusScope="True"
                                            KeyboardNavigation.TabNavigation="Local" />
                                    </Border>
                                </StackPanel>

                            </StackPanel>
                        </Controls:SinacorGridChangesMonitorContainer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding DataGrid.RowEditMode, RelativeSource={RelativeSource Self}}" Value="EditPanel" />
                                <Condition Binding="{Binding IsUpdating, RelativeSource={RelativeSource Self}}" Value="True" />
                            </MultiDataTrigger.Conditions>
                            <MultiDataTrigger.Setters>
                                <Setter Property="Visibility" Value="Visible" TargetName="PART_EditPanel" />
                                <Setter Property="Visibility" Value="Visible" TargetName="PART_EditBorder"/>
                            </MultiDataTrigger.Setters>
                        </MultiDataTrigger>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Background" TargetName="PART_StackRow" Value="{DynamicResource BrushDataGridRowSelectedBackground}" />
                        </Trigger>
                        <Trigger Property="XceedViews:ViewBase.IsLastItem" Value="True">
                            <Setter Property="Height" Value="{Binding ActualHeight, ElementName=PART_Row, Converter={StaticResource lastRowHeightConverter}}" TargetName="PART_StackRow" />
                            <Setter Property="BorderThickness" Value="1,0,1,1" TargetName="PART_EditBorder" />
                        </Trigger>
                        <DataTrigger Binding="{Binding HasErrors}" Value="False">
                            <Setter Property="ToolTip" Value="{x:Null}" TargetName="PART_Border" />
                        </DataTrigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <!-- This is to have an alternating row style-->
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, 
                                Path=Index, 
                                Converter={StaticResource rowIndexConverter}}" Value="True">
                <Setter Property="Background" Value="{DynamicResource BrushDataGridRowOddBackground}"/>
            </DataTrigger>

            <!--<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(XceedControls:ViewBase.IsLastItem)}"
                      Value="True">
                <Setter Property="Margin"
                    Value="0,0,0,5"/>
            </DataTrigger>-->

            <DataTrigger Binding="{Binding State}" Value="Inserted">
                <Setter Property="Background" Value="{DynamicResource BrushInserted}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding State}" Value="Updated">
                <Setter Property="Background" Value="{DynamicResource BrushUpdated}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding State}" Value="Deleted">
                <Setter Property="Background" Value="{DynamicResource BrushDeleted}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding HasErrors}" Value="True">
                <Setter Property="Background" Value="{DynamicResource BrushError}" />
            </DataTrigger>

        </Style.Triggers>
    </Style>

    <!-- InsertionRow -->
    <Style TargetType="{x:Type Controls:InsertionRow}" BasedOn="{StaticResource {x:Type Controls:BaseRow}}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:InsertionRow}">
                    <Border x:Name="PART_Border"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        Background="{TemplateBinding Background}"
                        Validation:ValidationManager.ValidationGroup="{x:Null}">
                        <Border.ToolTip>
                            <ItemsControl ItemsSource="{Binding Errors}" DisplayMemberPath="Message">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Orientation="Vertical" />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                            </ItemsControl>
                        </Border.ToolTip>
                        <Controls:SinacorGridChangesMonitorContainer  Name="PART_RowChangesMonitor" IsMonitoringChanges="False" Focusable="False">
                            <StackPanel x:Name="PART_Panel">
                                <StackPanel Background="{DynamicResource BrushInsertionRowBackground}" x:Name="PART_StackInsertionRow" Height="23">
                                    <ContentPresenter x:Name="PART_Row" />
                                </StackPanel>
                                <Border BorderThickness="1,0,1,1" BorderBrush="{DynamicResource BrushInsertionRowEditPaneBackground}" x:Name="PART_EditBorder" Visibility="Collapsed">
                                    <StackPanel Background="{DynamicResource BrushInsertionRowEditPaneStackPanel}">
                                        <Controls:InsertionRowEditPanel Margin="7" x:Name="PART_EditPanel"
                                            Content="{TemplateBinding DataContext}"
                                            ContentTemplate="{TemplateBinding PanelInsertTemplate}"
                                            ContentTemplateSelector="{TemplateBinding PanelInsertTemplateSelector}"
                                            Visibility="Collapsed"
                                            FocusManager.IsFocusScope="True"
                                            KeyboardNavigation.TabNavigation="Local" />
                                    </StackPanel>
                                </Border>
                            </StackPanel>
                        </Controls:SinacorGridChangesMonitorContainer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding DataGrid.RowEditMode, RelativeSource={RelativeSource Self}}" Value="EditPanel" />
                                <Condition Binding="{Binding IsInserting, RelativeSource={RelativeSource Self}}" Value="True" />
                            </MultiDataTrigger.Conditions>
                            <MultiDataTrigger.Setters>
                                <Setter Property="Visibility" Value="Visible" TargetName="PART_EditPanel" />
                                <Setter Property="Visibility" Value="Visible" TargetName="PART_EditBorder"/>
                            </MultiDataTrigger.Setters>
                        </MultiDataTrigger>
                        <DataTrigger Binding="{Binding HasErrors}" Value="False">
                            <Setter Property="ToolTip" Value="{x:Null}" TargetName="PART_Border" />
                        </DataTrigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding HasErrors}" Value="True">
                <Setter Property="Background" Value="{DynamicResource BrushError}" />
            </DataTrigger>
        </Style.Triggers>
    </Style>


    <!-- DataCell -->
    <Style TargetType="{x:Type ControlsInternal:DataCell}">
        <Setter Property="Height" Value="{Binding RowHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" />
        <Setter Property="MinHeight" Value="{Binding MinRowHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" />
    </Style>

    <!-- BaseCell -->
    <Style TargetType="{x:Type Controls:BaseCell}">
        <Setter Property="Margin" Value="-2,-2,-2,-2" />
        <Style.Resources>
            <Style TargetType="{x:Type Controls:SinacorTextBlock}" BasedOn="{StaticResource ControlDataGridTextBlock}" />
            <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource ControlDataGridLabel}" />
        </Style.Resources>
        <Style.Triggers>
            <!-- IsCurrent -->
            <Trigger Property="IsCurrent" Value="True">
                <Setter Property="Background" Value="{DynamicResource BrushDataGridCellCurrentBackground}">
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- Cell -->
    <Style TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:BaseCell}}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:Cell}">
                    <Border x:Name="PART_Border"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        Background="{TemplateBinding Background}"
                        Validation:ValidationManager.ValidationGroup="{x:Null}">
                        <Border.ToolTip>
                            <Controls:CellContentPresenter 
                                CellContent="{TemplateBinding CellContent}"
                                ContentStringFormat="{TemplateBinding StringFormat}"
                                ContentTemplate="{TemplateBinding CellTemplate}"
                                ContentTemplateSelector="{TemplateBinding CellTemplateSelector}"
                                Content="{TemplateBinding DataContext}" />
                        </Border.ToolTip>
                        <StackPanel x:Name="PART_Panel">
                            <Controls:CellContentPresenter x:Name="PART_Cell"
                                CellContent="{TemplateBinding CellContent}"
                                ContentStringFormat="{TemplateBinding StringFormat}"
                                ContentTemplate="{TemplateBinding CellTemplate}"
                                ContentTemplateSelector="{TemplateBinding CellTemplateSelector}"
                                Content="{TemplateBinding DataContext}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                            <Controls:CellEditContentPresenter x:Name="PART_CellEdit"
                                CellContent="{TemplateBinding CellContent}"
                                ContentStringFormat="{TemplateBinding StringFormat}"
                                ContentTemplate="{TemplateBinding CellUpdateTemplate}"
                                ContentTemplateSelector="{TemplateBinding CellUpdateTemplateSelector}"
                                Content="{TemplateBinding DataContext}"
                                Visibility="Collapsed" />
                        </StackPanel>
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition  Binding="{Binding RowEditMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" Value="AllCells" />
                                <Condition  Binding="{Binding IsUpdating, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:Row}}}" Value="True" />
                                <Condition  Binding="{Binding IsUpdating, RelativeSource={RelativeSource Self}}" Value="True" />
                            </MultiDataTrigger.Conditions>
                            <MultiDataTrigger.Setters>
                                <Setter Property="Visibility" Value="Collapsed" TargetName="PART_Cell" />
                                <Setter Property="Visibility" Value="Visible" TargetName="PART_CellEdit" />
                            </MultiDataTrigger.Setters>
                        </MultiDataTrigger>
                        <DataTrigger Binding="{Binding HasErrors}" Value="True">
                            <Setter Property="ToolTip" Value="{x:Null}" TargetName="PART_Border" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- InsertionCell -->
    <Style TargetType="{x:Type Controls:InsertionCell}" BasedOn="{StaticResource {x:Type Controls:BaseCell}}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:InsertionCell}">
                    <Border x:Name="PART_Border"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        Background="{TemplateBinding Background}"
                        Validation:ValidationManager.ValidationGroup="{x:Null}">
                        <Border.ToolTip>
                            <Controls:InsertionCellContentPresenter 
                                CellContent="{TemplateBinding CellContent}"
                                ContentStringFormat="{TemplateBinding StringFormat}"
                                ContentTemplate="{TemplateBinding CellTemplate}"
                                ContentTemplateSelector="{TemplateBinding CellTemplateSelector}"
                                Content="{TemplateBinding DataContext}" />
                        </Border.ToolTip>
                        <StackPanel x:Name="PART_Panel">
                            <Controls:InsertionCellContentPresenter x:Name="PART_Cell"
                                CellContent="{TemplateBinding CellContent}"
                                ContentStringFormat="{TemplateBinding StringFormat}"
                                ContentTemplate="{TemplateBinding CellTemplate}"
                                ContentTemplateSelector="{TemplateBinding CellTemplateSelector}"
                                Content="{TemplateBinding DataContext}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                            <Controls:InsertionCellEditContentPresenter x:Name="PART_CellEdit"
                                CellContent="{TemplateBinding CellContent}"
                                ContentStringFormat="{TemplateBinding StringFormat}"
                                ContentTemplate="{TemplateBinding CellInsertTemplate}"
                                ContentTemplateSelector="{TemplateBinding CellInsertTemplateSelector}"
                                Content="{TemplateBinding DataContext}"
                                Visibility="Collapsed" />
                        </StackPanel>
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition  Binding="{Binding RowEditMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}" Value="AllCells" />
                                <Condition  Binding="{Binding IsInserting, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:InsertionRow}}}" Value="True" />
                                <Condition  Binding="{Binding IsInserting, RelativeSource={RelativeSource Self}}" Value="True" />
                            </MultiDataTrigger.Conditions>
                            <MultiDataTrigger.Setters>
                                <Setter Property="Visibility" Value="Collapsed" TargetName="PART_Cell" />
                                <Setter Property="Visibility" Value="Visible" TargetName="PART_CellEdit" />
                            </MultiDataTrigger.Setters>
                        </MultiDataTrigger>
                        <DataTrigger Binding="{Binding HasErrors}" Value="True">
                            <Setter Property="ToolTip" Value="{x:Null}" TargetName="PART_Border" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <!-- Row Styles -->
    <Style x:Key="GridRowBusiness01" TargetType="{x:Type Controls:Row}" BasedOn="{StaticResource {x:Type Controls:Row}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
                <Style.Resources>
                    <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                        <Setter Property="Foreground" Value="{DynamicResource BrushGridRowBusiness01}" />
                    </Style>
                </Style.Resources>
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridRowBusiness02" TargetType="{x:Type Controls:Row}" BasedOn="{StaticResource {x:Type Controls:Row}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
                <Style.Resources>
                    <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                        <Setter Property="Foreground" Value="{DynamicResource BrushGridRowBusiness02}" />
                    </Style>
                </Style.Resources>
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridRowBusiness03" TargetType="{x:Type Controls:Row}" BasedOn="{StaticResource {x:Type Controls:Row}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
                <Style.Resources>
                    <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                        <Setter Property="Foreground" Value="{DynamicResource BrushGridRowBusiness03}" />
                    </Style>
                </Style.Resources>
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridRowBusiness04" TargetType="{x:Type Controls:Row}" BasedOn="{StaticResource {x:Type Controls:Row}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
                <Style.Resources>
                    <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                        <Setter Property="Foreground" Value="{DynamicResource BrushGridRowBusiness04}" />
                    </Style>
                </Style.Resources>
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridRowBusiness05" TargetType="{x:Type Controls:Row}" BasedOn="{StaticResource {x:Type Controls:Row}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
                <Style.Resources>
                    <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                        <Setter Property="Foreground" Value="{DynamicResource BrushGridRowBusiness05}" />
                    </Style>
                </Style.Resources>
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridRowBusiness06" TargetType="{x:Type Controls:Row}" BasedOn="{StaticResource {x:Type Controls:Row}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
                <Style.Resources>
                    <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                        <Setter Property="Foreground" Value="{DynamicResource BrushGridRowBusiness06}" />
                    </Style>
                </Style.Resources>
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridRowBusiness07" TargetType="{x:Type Controls:Row}" BasedOn="{StaticResource {x:Type Controls:Row}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
                <Style.Resources>
                    <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                        <Setter Property="Foreground" Value="{DynamicResource BrushGridRowBusiness07}" />
                    </Style>
                </Style.Resources>
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridRowBusiness08" TargetType="{x:Type Controls:Row}" BasedOn="{StaticResource {x:Type Controls:Row}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
                <Style.Resources>
                    <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                        <Setter Property="Foreground" Value="{DynamicResource BrushGridRowBusiness08}" />
                    </Style>
                </Style.Resources>
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridRowBusiness09" TargetType="{x:Type Controls:Row}" BasedOn="{StaticResource {x:Type Controls:Row}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
                <Style.Resources>
                    <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                        <Setter Property="Foreground" Value="{DynamicResource BrushGridRowBusiness09}" />
                    </Style>
                </Style.Resources>
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridRowBusiness10" TargetType="{x:Type Controls:Row}" BasedOn="{StaticResource {x:Type Controls:Row}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
                <Style.Resources>
                    <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                        <Setter Property="Foreground" Value="{DynamicResource BrushGridRowBusiness10}" />
                    </Style>
                </Style.Resources>
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridRowBusiness11" TargetType="{x:Type Controls:Row}" BasedOn="{StaticResource {x:Type Controls:Row}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
                <Style.Resources>
                    <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                        <Setter Property="Foreground" Value="{DynamicResource BrushGridRowBusiness11}" />
                    </Style>
                </Style.Resources>
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridRowBusiness12" TargetType="{x:Type Controls:Row}" BasedOn="{StaticResource {x:Type Controls:Row}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
                <Style.Resources>
                    <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                        <Setter Property="Foreground" Value="{DynamicResource BrushGridRowBusiness12}" />
                    </Style>
                </Style.Resources>
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridRowBusiness13" TargetType="{x:Type Controls:Row}" BasedOn="{StaticResource {x:Type Controls:Row}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
                <Style.Resources>
                    <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                        <Setter Property="Foreground" Value="{DynamicResource BrushGridRowBusiness13}" />
                    </Style>
                </Style.Resources>
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridRowBusiness14" TargetType="{x:Type Controls:Row}" BasedOn="{StaticResource {x:Type Controls:Row}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
                <Style.Resources>
                    <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                        <Setter Property="Foreground" Value="{DynamicResource BrushGridRowBusiness14}" />
                    </Style>
                </Style.Resources>
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridRowBusiness15" TargetType="{x:Type Controls:Row}" BasedOn="{StaticResource {x:Type Controls:Row}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
                <Style.Resources>
                    <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                        <Setter Property="Foreground" Value="{DynamicResource BrushGridRowBusiness15}" />
                    </Style>
                </Style.Resources>
            </Style>
        </Style.Resources>
    </Style>

    <!-- Cell Styles -->
    <Style x:Key="GridCellBusiness01" TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                <Setter Property="Foreground" Value="{DynamicResource BrushGridCellBusiness01}" />
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridCellBusiness02" TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                <Setter Property="Foreground" Value="{DynamicResource BrushGridCellBusiness02}" />
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridCellBusiness03" TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                <Setter Property="Foreground" Value="{DynamicResource BrushGridCellBusiness03}" />
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridCellBusiness04" TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                <Setter Property="Foreground" Value="{DynamicResource BrushGridCellBusiness04}" />
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridCellBusiness05" TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                <Setter Property="Foreground" Value="{DynamicResource BrushGridCellBusiness05}" />
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridCellBusiness06" TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                <Setter Property="Foreground" Value="{DynamicResource BrushGridCellBusiness06}" />
            </Style>
        </Style.Resources>
    </Style>
    <Style x:Key="GridCellBusiness07" TargetType="{x:Type Controls:Cell}" BasedOn="{StaticResource {x:Type Controls:Cell}}">
        <Style.Resources>
            <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource {x:Type Controls:SinacorLabel}}">
                <Setter Property="Foreground" Value="{DynamicResource BrushGridCellBusiness07}" />
            </Style>
        </Style.Resources>
    </Style>




    <Thickness x:Key="cellPadding"
           Left="2"
           Top="2"
           Right="2"
           Bottom="2" />

    <!--BEGIN CELL HEADER-->

    <!--END CEL  HEADER-->

    <Style x:Key="invisibleThumbStyle"
       TargetType="Thumb">

        <Setter Property="MinWidth"
        Value="{DynamicResource {x:Static SystemParameters.ResizeFrameVerticalBorderWidthKey}}" />

        <Setter Property="MinHeight"
        Value="{DynamicResource {x:Static SystemParameters.ResizeFrameHorizontalBorderHeightKey}}" />

        <Setter Property="Template">
            <Setter.Value>

                <ControlTemplate TargetType="Thumb">
                    <Grid Background="Transparent" />
                </ControlTemplate>

            </Setter.Value>
        </Setter>
    </Style>

    <!--Begin ColumnManagerCell-->
    <ControlTemplate x:Key="tableViewColumnManagerCellTemplate" TargetType="ControlsInternal:ColumnManagerCell">
        <!-- We don't use the base Cell Template for the ColumnManagerCell because it need more elements
           to function properly: a Thumb named "PART_ColumnResizerThumb" that is used to resize the
           ColumnManagerCells's ParentColumn.Width and a glyph that represents the Column's SortDirection. -->
        <!-- This Grid is used to position the resizer Thumb over the ColumnManagerCell -->

        <Border x:Name="border" Height="22" Background="{DynamicResource BrushGridCellHeaderBackground}">
            <Border.ContextMenu>

                <Controls:SinacorContextMenu x:Name="ColumnManagerCellContextMenu">
                    <StackPanel x:Name="ShowHideColumnsPanel">
                        <StackPanel.Style>
                            <Style>
                                <Style.Triggers>
                                    <!-- Esconde exibir/ocultar colunas se estiver editando -->
                                    <DataTrigger Binding="{Binding ExternalColumn.DataGrid.IsEditing, RelativeSource={RelativeSource TemplatedParent}}" Value="True">
                                        <Setter Property="UIElement.Visibility" Value="Collapsed" />
                                    </DataTrigger>

                                    <!-- Esconde exibir/ocultar colunas se nenhuma visibilidade puder ser alterada -->
                                    <DataTrigger Binding="{Binding ExternalColumn.DataGrid.ChangeVisibilityColumns.IsEmpty, RelativeSource={RelativeSource TemplatedParent}}" Value="True">
                                        <Setter Property="UIElement.Visibility" Value="Collapsed" />
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </StackPanel.Style>
                        <Controls:SinacorScrollViewer Width="Auto" Height="Auto" MinWidth="180" MaxWidth="250" MaxHeight="300" Margin="7"
                                          VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
                            <ItemsControl ItemsSource="{Binding ExternalColumn.DataGrid.ChangeVisibilityColumns, RelativeSource={RelativeSource TemplatedParent}}">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Orientation="Vertical" IsItemsHost="True" />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <Controls:SinacorCheckBox Name="chkColumn"
                                              IsChecked="{Binding Visible}"
                                              ContentTemplate="{Binding TitleTemplate}"
                                              ContentTemplateSelector="{Binding TitleTemplateSelector}"
                                              Style="{DynamicResource ControlCheckBoxDarkBackground}" />
                                        <DataTemplate.Triggers>
                                            <MultiDataTrigger>
                                                <MultiDataTrigger.Conditions>
                                                    <Condition Binding="{Binding DataGrid.CanHideColumn}" Value="False" />
                                                    <Condition Binding="{Binding Visible}" Value="True" />
                                                </MultiDataTrigger.Conditions>
                                                <MultiDataTrigger.Setters>
                                                    <Setter Property="IsEnabled" Value="False" TargetName="chkColumn" />
                                                </MultiDataTrigger.Setters>
                                            </MultiDataTrigger>
                                        </DataTemplate.Triggers>
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                            </ItemsControl>
                        </Controls:SinacorScrollViewer>
                    </StackPanel>

                    <Controls:SinacorContextMenuItemSeparator x:Name="Separator" />

                    <StackPanel x:Name="UnfreezeColumnsPanel">
                        <StackPanel.Style>
                            <Style>
                                <Style.Triggers>
                                    <!-- Esconde descongelar colunas se não exiber splitter -->
                                    <DataTrigger Binding="{Binding ExternalColumn.DataGrid.ShowFixedColumnSplitter, RelativeSource={RelativeSource TemplatedParent}}" Value="False">
                                        <Setter Property="UIElement.Visibility" Value="Collapsed" />
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </StackPanel.Style>
                        <Controls:SinacorContextMenuItem Header="{DynamicResource Infra.Controls.Label.DescongelarColunas}"
                                             Command="Controls:SinacorDataGrid.UnfreezeColumns"
                                             CommandTarget="{Binding ExternalColumn.DataGrid, RelativeSource={RelativeSource TemplatedParent}}" />
                    </StackPanel>
                </Controls:SinacorContextMenu>

            </Border.ContextMenu>

            <!-- This Grid is used to position the resizer Thumb over the ColumnManagerCell -->
            <Grid>

                <Rectangle Fill="{DynamicResource BrushResizerRectangle}"
               HorizontalAlignment="Right"
               VerticalAlignment="Stretch"
               Width="1"
               Margin="0"/>

                <DockPanel>
                    <Border x:Name="thumbToggleBackgroundBorder"
             DockPanel.Dock="Right">

                        <Grid>

                            <!-- Thumb that is used to resize the Column. -->
                            <Thumb x:Name="PART_ColumnResizerThumb"
              Style="{DynamicResource invisibleThumbStyle}"
              Width="6"
              HorizontalAlignment="Right"/>

                        </Grid>

                    </Border>

                    <!-- This Grid is used to layout the delimiter lines on top of the ContentPresenter -->
                    <Border>

                        <!-- This StackPanel is used to layout the ContentPresenter and the Sort Glyph (when present). -->
                        <StackPanel x:Name="contentPanel" HorizontalAlignment="Center"
                Orientation="Horizontal">
                            <Grid>
                                <!-- Same ContentPresenter as in the base Cell Template. -->
                                <ContentPresenter Margin="14,0,0,0" x:Name="cellContentPresenter" Content="{XceedControls:CellContentBinding}"
                     ContentTemplate="{TemplateBinding ContentTemplate}"
                     ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                     HorizontalAlignment="Center" VerticalAlignment="Center"
                     Style="{DynamicResource ControlFont}" TextElement.Foreground="{DynamicResource BrushResizerForeground}">
                                </ContentPresenter>
                            </Grid>
                            <Grid Width="10">
                                <!-- ContentPresenter that is used to display the sort glyph.
                  We explicitly set its Content property to Null to prevent the XAML parser
                  from implicitly setting it to its TemplatedParent's Content. -->
                                <ContentPresenter x:Name="sortGlyphPresenter"
                     Content="{x:Null}"
                     ContentTemplate="{x:Null}" TextElement.Foreground="{DynamicResource BrushResizerForeground}" Margin="3,0,0,0" />
                            </Grid>

                        </StackPanel>
                    </Border>

                </DockPanel>

            </Grid>

        </Border>

        <ControlTemplate.Triggers>
            <!-- Esconde o menu se os dois paineis estiverem ocultos -->
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Visibility" Value="Collapsed" SourceName="ShowHideColumnsPanel" />
                    <Condition Property="Visibility" Value="Collapsed" SourceName="UnfreezeColumnsPanel" />
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" Value="Collapsed" TargetName="ColumnManagerCellContextMenu" />
            </MultiTrigger>

            <!-- Esconde o separador se um dos paineis estiver oculto -->
            <Trigger Property="Visibility" Value="Collapsed" SourceName="ShowHideColumnsPanel">
                <Setter Property="Visibility" Value="Collapsed" TargetName="Separator" />
            </Trigger>
            <Trigger Property="Visibility" Value="Collapsed" SourceName="UnfreezeColumnsPanel">
                <Setter Property="Visibility" Value="Collapsed" TargetName="Separator" />
            </Trigger>

            <Trigger Property="IsMouseOver" Value="True">

                <Setter TargetName="border"
            Property="Background"
            Value="{DynamicResource BrushGridCellHeaderBackgroundHover}" />

            </Trigger>

            <Trigger Property="IsPressed"
            Value="True">

                <Setter TargetName="border"
            Property="Background"
            Value="{DynamicResource BrushGridCellHeaderBackgroundPressed}" />

            </Trigger>

            <!-- The following 2 triggers allow the appropriate Sort Glyph to be displayed
              depending on the ParentColumn's SortDirection. -->

            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ExternalColumn.SortDirection}"
                Value="Ascending">

                <Setter TargetName="sortGlyphPresenter"
            Property="ContentPresenter.ContentTemplate"
            Value="{XceedControls:ViewBinding AscendingSortGlyph}"/>

                <!--<Setter TargetName="sortGlyphPresenter"
                    Property="Margin"
                    Value="6,0,0,0"/>-->

            </DataTrigger>

            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ExternalColumn.SortDirection}"
                Value="Descending">

                <Setter TargetName="sortGlyphPresenter"
            Property="ContentPresenter.ContentTemplate"
            Value="{XceedControls:ViewBinding DescendingSortGlyph}"/>

                <!--<Setter TargetName="sortGlyphPresenter"
                    Property="Margin"
                    Value="6,0,0,0"/>-->

            </DataTrigger>

            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.HasFixedWidth}"
                Value="True">
                <Setter TargetName="PART_ColumnResizerThumb"
            Property="IsEnabled"
            Value="False"/>
            </DataTrigger>

            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.Visible}"
                Value="False">
                <Setter Property="Visibility"
            Value="Collapsed"/>
            </DataTrigger>

        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="ControlsInternal:ColumnManagerCell">
        <!-- Set the Cell's background to Transparent to make it hit-testable
           while preserving the background drawn by the underlying Row. -->
        <!-- In TableView, each Cell has the same width as its ParentColum's ActualWidth -->
        <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ParentColumn.ActualWidth}" />
        <Setter Property="Padding" Value="{StaticResource cellPadding}" />
        <Setter Property="Template" Value="{StaticResource tableViewColumnManagerCellTemplate}" />
        <!--<Style.Resources>
            <Style TargetType="Controls:SinacorLabel">
                <Setter Property="Width" Value="Auto" />
                <Setter Property="HorizontalAlignment" Value="Left" />
            </Style>
        </Style.Resources>-->
    </Style>
    <!--End ColumnManagerCell-->


    <!--Begin GroupByControl-->
    <Style TargetType="ControlsInternal:GroupByControl">
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFFEFEFE" Offset="0"/>
                    <GradientStop Color="#FFC3C3C3" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
    </Style>
    <!--End GroupByControl-->

    <!--Begin GroupByItem-->
    <Style TargetType="ControlsInternal:GroupByItem">
        <Setter Property="Padding" Value="{StaticResource cellPadding}" />
        <Setter Property="Template">
            <Setter.Value>

                <ControlTemplate TargetType="ControlsInternal:GroupByItem">
                    <Border x:Name="border" Height="22" BorderThickness="1" BorderBrush="{DynamicResource GroupByItemBorder}" Background="{DynamicResource BrushGridCellHeaderBackground}">

                        <!-- This Grid is used to position the resizer Thumb over the ColumnManagerCell -->
                        <Grid>

                            <!--<Rectangle Fill="#FFC0C0C0"
                       HorizontalAlignment="Right"
                       VerticalAlignment="Stretch"
                       Width="1"
                       Margin="0"/>-->

                            <DockPanel>

                                <!-- This Grid is used to layout the delimiter lines on top of the ContentPresenter -->
                                <Border>

                                    <!-- This StackPanel is used to layout the ContentPresenter and the Sort Glyph (when present). -->
                                    <StackPanel x:Name="contentPanel" HorizontalAlignment="Center"
                                       Orientation="Horizontal">
                                        <Grid>
                                            <!-- Same ContentPresenter as in the base Cell Template. -->
                                            <ContentPresenter Margin="10,0,10,0" x:Name="cellContentPresenter" Content="{XceedControls:CellContentBinding}"
                                               ContentTemplate="{TemplateBinding ContentTemplate}"
                                               ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                               HorizontalAlignment="Center" VerticalAlignment="Center"
                                               Style="{DynamicResource ControlFont}" TextElement.Foreground="{DynamicResource GroupByItemForeground}">
                                            </ContentPresenter>
                                        </Grid>

                                    </StackPanel>
                                </Border>

                            </DockPanel>

                        </Grid>

                    </Border>

                    <ControlTemplate.Triggers>

                        <Trigger Property="IsMouseOver" Value="True">

                            <Setter TargetName="border"
                                  Property="Background"
                                  Value="{DynamicResource BrushGridCellHeaderBackgroundHover}" />

                        </Trigger>

                        <Trigger Property="IsPressed"
                                Value="True">

                            <Setter TargetName="border"
                                      Property="Background"
                                      Value="{DynamicResource BrushGridCellHeaderBackgroundPressed}" />

                        </Trigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>

            </Setter.Value>
        </Setter>
    </Style>
    <!--End GroupByItem-->

    <DataTemplate DataType="{x:Type XceedControls:Group}">
        <StackPanel Orientation="Horizontal">
            <StackPanel.Resources>
                <Style TargetType="{x:Type Controls:SinacorTextBlock}" BasedOn="{StaticResource ControlDataGridTextBlock}">
                    <Setter Property="Height" Value="Auto" />
                    <Setter Property="MinHeight" Value="0" />
                    <Setter Property="Padding" Value="0" />
                    <Setter Property="Margin" Value="0" />
                </Style>
                <Style TargetType="{x:Type Controls:SinacorLabel}" BasedOn="{StaticResource ControlDataGridLabel}">
                    <Setter Property="Height" Value="Auto" />
                    <Setter Property="MinHeight" Value="0" />
                    <Setter Property="Padding" Value="0" />
                    <Setter Property="Margin" Value="0" />
                </Style>
            </StackPanel.Resources>
            <ContentPresenter ContentTemplate="{Binding TitleTemplate}"
                        ContentTemplateSelector="{Binding TitleTemplateSelector}"
                        Style="{DynamicResource ControlFont}" VerticalAlignment="Top" Margin="0,3,0,3" />
            <Controls:SinacorTextBlock Text=": " VerticalAlignment="Top" Margin="0,3,0,3" />
            <ContentControl Content="{Binding Value.Item}"
                      ContentTemplate="{Binding ValueTemplate}"
                      ContentTemplateSelector="{Binding ValueTemplateSelector}"
                      Focusable="False" VerticalAlignment="Top" Margin="3" />
            <Controls:SinacorTextBlock Text=" (" VerticalAlignment="Top" Margin="0,3,0,3" />
            <Controls:SinacorTextBlock Text="{Binding Items.Count}" VerticalAlignment="Top" Margin="0,3,0,3" />
            <Controls:SinacorTextBlock Text=" " VerticalAlignment="Top" Margin="0,3,0,3" />
            <Controls:SinacorTextBlock Text="{DynamicResource Infra.Controls.Label.Item}" x:Name="PART_Item" Visibility="Collapsed" VerticalAlignment="Top" Margin="0,3,0,3" />
            <Controls:SinacorTextBlock Text="{DynamicResource Infra.Controls.Label.Itens}" x:Name="PART_Items" VerticalAlignment="Top" Margin="0,3,0,3" />
            <Controls:SinacorTextBlock Text=")" VerticalAlignment="Top" Margin="0,3,0,3" />
        </StackPanel>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding Items.Count}" Value="1">
                <Setter Property="Visibility" Value="Visible" TargetName="PART_Item" />
                <Setter Property="Visibility" Value="Collapsed" TargetName="PART_Items" />
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>




    <!--<Style x:Key="itemIndexSelectorStyle"
           TargetType="{x:Type XceedControls:RowSelector}">
        <Setter Property="Content"
              Value="{Binding RelativeSource={RelativeSource Self}, Path=ItemIndex}"/>
    </Style>
    <Style TargetType="{x:Type XceedControls:Row}">
        <Setter Property="XceedControls:RowSelector.RowSelectorStyle"
              Value="{StaticResource itemIndexSelectorStyle}" />
    </Style>-->


    <Style TargetType="XceedControls:RowSelectorPane">
        <Setter Property="Background" Value="Transparent" />
    </Style>

    <Style TargetType="XceedControls:RowSelector">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="XceedControls:RowSelector">
                    <Grid>
                        <Grid.ToolTip>
                            <ItemsControl ItemsSource="{Binding DataContext.Errors}" DisplayMemberPath="Message">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Orientation="Vertical" />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                            </ItemsControl>
                        </Grid.ToolTip>
                        <Border Background="{TemplateBinding Panel.Background}" Name="rootBorder">
                            <Grid>
                                <Border Padding="{TemplateBinding Control.Padding}">
                                    <Grid>
                                        <Path x:Name="PART_Arrow"  Visibility="Collapsed" Width="8"   Height="7" Stretch="Fill" Fill="#FF0033FF" Data="F1 M -3.05176e-005,2.1265L 3.11682,2.1265L 3.11682,0L 8.13379,3.54236L 3.11682,7.08475L 3.11682,5.1265L -3.05176e-005,5.1265L -3.05176e-005,2.1265 Z "                                                                                                           HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,0" />
                                        <Path x:Name="PART_New"    Visibility="Collapsed" Width="6"   Height="7" Stretch="Fill" Fill="#FF0FA900" Data="F1 M 5.69336,6.81332L 4.02939,6.81332L 1.58667,2.06354L 1.58667,6.81332L 0,6.81332L 0,0L 2.08545,0L 4.10669,3.90247L 4.10669,0L 5.69336,0L 5.69336,6.81332 Z "                                                                                                   HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,0" />
                                        <Path x:Name="PART_Change" Visibility="Collapsed" Width="3"   Height="8" Stretch="Fill" Fill="#FFFF8B00" Data="M0,6.2266259 L2.2163616,6.2266259 2.2163616,7.9545064 0,7.9545064 0,6.1253073 z M0,0 L2.2163616,0 2.2163616,5.3243072 0,5.3243072 0,0 z"                                                                                                                         HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,0" />
                                        <Path x:Name="PART_Delete" Visibility="Collapsed" Width="6.5" Height="7" Stretch="Fill" Fill="#FF990000" Data="F1 M 6.53339,6.81329L 4.54712,6.81329L 3.2171,4.77747L 2.00085,6.81329L 0,6.81329L 2.27063,3.32935L 0.0933533,0L 2.07959,0L 3.26376,1.97455L 4.43918,0L 6.44003,0L 4.26422,3.33954L 6.53339,6.81329 Z "                                                          HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,0" />
                                        <Path x:Name="PART_Error"  Visibility="Collapsed" Width="5"   Height="7" Stretch="Fill" Fill="#FFFF3300" Data="M0.80797368,2.9375925 L6.0912819,2.9375925 L6.0912819,4.4276218 L2.7597022,4.4276218 L2.7597022,5.7969794 L5.8289528,5.7969794 L5.8289528,7.2870088 L2.7597022,7.2870088 L2.7597022,9.2597237 L6.0912819,9.2597237 L6.0912819,10.749753 L0.80797368,10.749753 z" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,0" />
                                    </Grid>
                                    <!--<ContentPresenter Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" Name="contentPresenter" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" />-->
                                </Border>
                                <Border BorderThickness="1,1,0,0" Name="isPressedDarkInnerHighlight">
                                    <Border BorderThickness="1,1,0,0" Name="isPressedLightInnerHighlight" />
                                </Border>
                            </Grid>
                        </Border>

                        <Border Name="selectedMouseOverRightBorder" Width="4" Background="{DynamicResource RowSelectorBorder}" HorizontalAlignment="Right" Visibility="Collapsed">
                            <Border Width="4" Height="Auto" VerticalAlignment="Stretch">
                                <Border.Background>
                                    <DrawingBrush Viewbox="0,0,3,22" ViewboxUnits="Absolute">
                                        <DrawingBrush.Drawing>
                                            <DrawingGroup>
                                                <GeometryDrawing Brush="{DynamicResource GeometricDrawing1}">
                                                    <GeometryDrawing.Geometry>
                                                        <RectangleGeometry RadiusX="0" RadiusY="0" Rect="0,0,3,22"/>
                                                    </GeometryDrawing.Geometry>
                                                </GeometryDrawing>
                                                <DrawingGroup>
                                                    <DrawingGroup.Transform>
                                                        <MatrixTransform Matrix="1,0,0,1,0.338,8.66"/>
                                                    </DrawingGroup.Transform>
                                                    <GeometryDrawing Brush="{DynamicResource GeometricDrawing2}" Geometry="M5.8195542E-06,0 L5.8195542E-06,6.0829962 2.5819994,3.0476747 z"/>
                                                </DrawingGroup>
                                                <DrawingGroup>
                                                    <DrawingGroup.Transform>
                                                        <MatrixTransform Matrix="1,0,0,1,0.218,7.92"/>
                                                    </DrawingGroup.Transform>
                                                    <GeometryDrawing Brush="{DynamicResource GeometricDrawing3}" Geometry="M5.8195542E-06,0 L5.8195542E-06,6.0829962 2.5819994,3.0476747 z"/>
                                                </DrawingGroup>
                                            </DrawingGroup>
                                        </DrawingBrush.Drawing>
                                    </DrawingBrush>
                                </Border.Background>
                            </Border>
                        </Border>

                        <Border Name="selectedRightBorder" Width="4" Background="{DynamicResource RowSelectorRightBorder}" HorizontalAlignment="Right" Visibility="Collapsed">
                            <Border Width="4" Height="Auto" VerticalAlignment="Stretch">
                                <Border.Background>
                                    <DrawingBrush Viewbox="0,0,3,22" ViewboxUnits="Absolute">
                                        <DrawingBrush.Drawing>
                                            <DrawingGroup>
                                                <GeometryDrawing Brush="{DynamicResource GeometricDrawing4}">
                                                    <GeometryDrawing.Geometry>
                                                        <RectangleGeometry RadiusX="0" RadiusY="0" Rect="0,0,3,22"/>
                                                    </GeometryDrawing.Geometry>
                                                </GeometryDrawing>
                                                <DrawingGroup>
                                                    <DrawingGroup.Transform>
                                                        <MatrixTransform Matrix="1,0,0,1,0.338,8.66"/>
                                                    </DrawingGroup.Transform>
                                                    <GeometryDrawing Brush="{DynamicResource GeometricDrawing5}" Geometry="M5.8195542E-06,0 L5.8195542E-06,6.0829962 2.5819994,3.0476747 z"/>
                                                </DrawingGroup>
                                                <DrawingGroup>
                                                    <DrawingGroup.Transform>
                                                        <MatrixTransform Matrix="1,0,0,1,0.218,7.92"/>
                                                    </DrawingGroup.Transform>
                                                    <GeometryDrawing Brush="{DynamicResource GeometricDrawing6}" Geometry="M5.8195542E-06,0 L5.8195542E-06,6.0829962 2.5819994,3.0476747 z"/>
                                                </DrawingGroup>
                                            </DrawingGroup>
                                        </DrawingBrush.Drawing>
                                    </DrawingBrush>
                                </Border.Background>
                            </Border>
                        </Border>

                        <!--<Grid Name="rightBorder" Width="3" HorizontalAlignment="Right">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="3" />
                                <RowDefinition />
                                <RowDefinition Height="3" />
                            </Grid.RowDefinitions>
                            <Border Name="topRightBorder" Grid.Row="0">
                                <Border.Background>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Color="#FFF9FAFD" Offset="0" />
                                            <GradientStop Color="#FFBDBECE" Offset="1" />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                            <Border Name="middleRightBorder" Grid.Row="1">
                                <Border.Background>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Color="#FFF9FAFD" Offset="0" />
                                            <GradientStop Color="#FFBDBECE" Offset="1" />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                            <Border Name="bottomRightBorder" Grid.Row="2">
                                <Border.Background>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Color="#FFF9FAFD" Offset="0" />
                                            <GradientStop Color="#FFBDBECE" Offset="1" />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                        </Grid>-->

                        <Rectangle Fill="{DynamicResource Rectangle1}" Name="topBorder" Height="1" Margin="3,0,4,0" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                        <Rectangle Fill="{DynamicResource Rectangle2}" Name="bottomBorder" Height="1" Margin="3,0,4,0" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" />
                        <Thumb Name="PART_RowResizerThumb" VerticalAlignment="Bottom" IsEnabled="False">
                            <Thumb.Style>
                                <Style TargetType="Thumb">
                                    <Style.Resources>
                                        <ResourceDictionary />
                                    </Style.Resources>
                                    <Setter Property="FrameworkElement.MinWidth">
                                        <Setter.Value>
                                            <DynamicResource ResourceKey="{x:Static SystemParameters.ResizeFrameVerticalBorderWidthKey}" />
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="FrameworkElement.MinHeight">
                                        <Setter.Value>
                                            <DynamicResource ResourceKey="{x:Static SystemParameters.ResizeFrameHorizontalBorderHeightKey}" />
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Control.Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="Thumb">
                                                <Grid Background="{DynamicResource RowResizerThumb}" />
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </Thumb.Style>
                        </Thumb>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <!--<Trigger Property="UIElement.IsMouseOver" Value="True">
                            <Setter Property="Panel.Background" TargetName="rootBorder">
                                <Setter.Value>
                                    <SolidColorBrush>#FFFAF8F3</SolidColorBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Border.BorderThickness" TargetName="topRightBorder">
                                <Setter.Value>
                                    <Thickness>1,0,1,1</Thickness>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Border.CornerRadius" TargetName="topRightBorder">
                                <Setter.Value>
                                    <CornerRadius>0,3,0,0</CornerRadius>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Border.BorderBrush" TargetName="topRightBorder">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0.5" EndPoint="0.5,1">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Color="#FFFDE3AB" Offset="0" />
                                            <GradientStop Color="#FFF9A900" Offset="1" />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Panel.Background" TargetName="topRightBorder">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0.5" EndPoint="0.5,1">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Color="#FFFCE0A6" Offset="0" />
                                            <GradientStop Color="#FFFCC247" Offset="1" />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Border.BorderThickness" TargetName="middleRightBorder">
                                <Setter.Value>
                                    <Thickness>1,0,1,0</Thickness>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Border.BorderBrush" TargetName="middleRightBorder">
                                <Setter.Value>
                                    <SolidColorBrush>#FFF9A900</SolidColorBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Panel.Background" TargetName="middleRightBorder">
                                <Setter.Value>
                                    <SolidColorBrush>#FFFCC247</SolidColorBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Border.BorderThickness" TargetName="bottomRightBorder">
                                <Setter.Value>
                                    <Thickness>0,1,1,1</Thickness>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Border.CornerRadius" TargetName="bottomRightBorder">
                                <Setter.Value>
                                    <CornerRadius>0,0,3,0</CornerRadius>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Border.BorderBrush" TargetName="bottomRightBorder">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0.5" EndPoint="0.5,1">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Color="#FFF8A900" Offset="0" />
                                            <GradientStop Color="#FFDE9600" Offset="1" />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Panel.Background" TargetName="bottomRightBorder">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0.5" EndPoint="0.5,1">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Color="#FFDD9600" Offset="1" />
                                            <GradientStop Color="#FFFCC247" Offset="0" />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="UIElement.Visibility" TargetName="topBorder">
                                <Setter.Value>
                                    <x:Static Member="Visibility.Hidden" />
                                </Setter.Value>
                            </Setter>
                            <Setter Property="UIElement.Visibility" TargetName="bottomBorder">
                                <Setter.Value>
                                    <x:Static Member="Visibility.Hidden" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>-->
                        <Trigger Property="XceedControls:RowSelector.IsPressed" Value="True">
                            <Setter Property="Panel.Background" TargetName="rootBorder" Value="{DynamicResource Trigger1}" />
                            <Setter Property="Border.BorderBrush" TargetName="rootBorder" Value="{DynamicResource Trigger2}"/>
                            <Setter Property="Border.BorderThickness" TargetName="rootBorder">
                                <Setter.Value>
                                    <Thickness>0,1,1,1</Thickness>
                                </Setter.Value>
                            </Setter>
                            <!--<Setter Property="FrameworkElement.Margin" TargetName="contentPresenter">
                                <Setter.Value>
                                    <Thickness>3,0,0,0</Thickness>
                                </Setter.Value>
                            </Setter>-->
                            <Setter Property="UIElement.Visibility" TargetName="selectedMouseOverRightBorder">
                                <Setter.Value>
                                    <x:Static Member="Visibility.Hidden" />
                                </Setter.Value>
                            </Setter>
                            <Setter Property="UIElement.Visibility" TargetName="selectedRightBorder">
                                <Setter.Value>
                                    <x:Static Member="Visibility.Hidden" />
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Border.BorderBrush" TargetName="isPressedLightInnerHighlight" Value="{DynamicResource Trigger3}"/>
                            <Setter Property="Border.BorderBrush" TargetName="isPressedDarkInnerHighlight" Value="{DynamicResource Trigger4}"/>
                        </Trigger>

                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="False" />
                                <Condition Binding="{Binding DataContext.IsSelected, RelativeSource={RelativeSource Self}}" Value="True" />
                            </MultiDataTrigger.Conditions>
                            <Setter Property="Visibility" Value="Visible" TargetName="selectedRightBorder" />
                            <Setter Property="Background" Value="{DynamicResource Trigger5}" TargetName="rootBorder" />
                        </MultiDataTrigger>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True" />
                                <Condition Binding="{Binding DataContext.IsSelected, RelativeSource={RelativeSource Self}}" Value="True" />
                            </MultiDataTrigger.Conditions>
                            <Setter Property="Visibility" Value="Visible" TargetName="selectedMouseOverRightBorder" />
                        </MultiDataTrigger>

                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="False" />
                                <Condition Binding="{Binding DataContext.IsCurrent, RelativeSource={RelativeSource Self}}" Value="True" />
                            </MultiDataTrigger.Conditions>
                            <Setter Property="Visibility" Value="Visible" TargetName="selectedRightBorder" />
                            <Setter Property="Background" Value="{DynamicResource Trigger5}" TargetName="rootBorder" />
                        </MultiDataTrigger>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True" />
                                <Condition Binding="{Binding DataContext.IsCurrent, RelativeSource={RelativeSource Self}}" Value="True" />
                            </MultiDataTrigger.Conditions>
                            <Setter Property="Visibility" Value="Visible" TargetName="selectedMouseOverRightBorder" />
                        </MultiDataTrigger>

                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding DataContext.IsCurrent, RelativeSource={RelativeSource Self}}" Value="True" />
                                <Condition Binding="{Binding DataContext.State}" Value="Unchanged" />
                                <Condition Binding="{Binding DataContext.HasErrors}" Value="False" />
                            </MultiDataTrigger.Conditions>
                            <Setter Property="Visibility" Value="Visible" TargetName="PART_Arrow" />
                        </MultiDataTrigger>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding DataContext.State}" Value="Inserted" />
                                <Condition Binding="{Binding DataContext.HasErrors}" Value="False" />
                            </MultiDataTrigger.Conditions>
                            <Setter Property="Visibility" Value="Visible" TargetName="PART_New" />
                        </MultiDataTrigger>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding DataContext.State}" Value="Updated" />
                                <Condition Binding="{Binding DataContext.HasErrors}" Value="False" />
                            </MultiDataTrigger.Conditions>
                            <Setter Property="Visibility" Value="Visible" TargetName="PART_Change" />
                        </MultiDataTrigger>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding DataContext.State}" Value="Deleted" />
                                <Condition Binding="{Binding DataContext.HasErrors}" Value="False" />
                            </MultiDataTrigger.Conditions>
                            <Setter Property="Visibility" Value="Visible" TargetName="PART_Delete" />
                        </MultiDataTrigger>
                        <DataTrigger Binding="{Binding DataContext.HasErrors}" Value="True">
                            <Setter Property="Visibility" Value="Visible" TargetName="PART_Error" />
                        </DataTrigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
